<template>
    <div>
        <HomeHeader  :type_="type_"></HomeHeader>
        <v-content>
            <v-container ><v-card ref="form">
                <v-col class="main" >
                    用户注册
                    <v-form>
                        <v-text-field
                                v-for="(item,i) in itemsone"
                                :key="i"
                                :label="item.label"
                                v-model="data[item.key]"
                                placeholder=" "
                                required
                        ></v-text-field>
                        <v-expansion-panels flat popout>
                            <v-expansion-panel>
                                <v-expansion-panel-header>更多{{test}}</v-expansion-panel-header>
                                <v-expansion-panel-content>
                                    <v-text-field
                                            v-for="(item,i) in itemstwo"
                                            :key="i"
                                            :label="item.label"
                                            v-model="data[item.key]"
                                            placeholder=" "
                                    ></v-text-field>
                                </v-expansion-panel-content>
                            </v-expansion-panel>
                        </v-expansion-panels>
                        <v-text-field
                                v-model="data.use_password"
                                :append-icon="show1 ? 'mdi-eye' : 'mdi-eye-off'"
                                :type="show1 ? 'text' : 'password'"
                                @click:append="show1 = !show1"
                                label="密码"
                                placeholder=" "
                                required
                        ></v-text-field>
                            <v-text-field
                                    :append-icon="show2 ? 'mdi-eye' : 'mdi-eye-off'"
                                    :type="show2 ? 'text' : 'password'"
                                    @click:append="show2 = !show2"
                                    label="再次输入密码"
                                    placeholder=" "
                            ></v-text-field>
                        <div class="text-center">
                            <v-btn rounded color="primary" dark @click="_signup">注册</v-btn>
                        </div>
                    </v-form>
                </v-col>

            </v-card></v-container >
        </v-content>
        <Home-Footer :type_="type_"></Home-Footer>
    </div>
</template>

<script>
  export default {
  data() {
    return {
        // type_:'use',
        test:null,
        show1:null,
        show2:null,
        itemsone:[
            {label:"姓名",key:'use_name'},
            {label:"手机号码",key:'use_contact'},
        ],
        itemstwo:[
            {label:"年龄",key:'use_age'},
            {label:"性别",key:'use_sex'},
            {label:"住址",key:'use_address'},
            {label:"邮箱",key:'use_email'},
            {label:"身份证",key:'use_idcard'},
        ],
        data:{
            use_name:'',
            use_password:'',
            use_contact:'',
            use_age:'',
            use_sex:'',
            use_address:'',
            use_email:'',
            use_idcard:'',
            _option:''
        },
        response:''
    }
  },computed: {
          type_() {
              var x='use'
              if (this.$cookies.isKey('username')) {
                  if (this.$cookies.get('username') == 0) {
                      x= 'adm_ok'
                  } else if (this.$cookies.get('username') == 1) {
                      x= 'use_ok'
                  }
              }
              else {
                  x= 'use'
              }
              return x
          }
      },
      methods: {
          _signup(){
              var params=this.data
              params._option ='2000'
              this.$http.post(params,2).then((res)=>{
                  this.response=res
              }).catch((err)=>{
                  this.response=err
              })
          }
      }
}
</script>


<style  scoped>
</style>
